﻿using StackExchange.Profiling;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _4_NovaAdmin.Web.Core.ServiceExtensions
{
    /// <summary>
    /// MiniProfiler 启动服务
    /// </summary>
    public static class MiniProfilerSetup
    {
        public static void AddMiniProfiler(this IServiceCollection services)
        {
            ArgumentNullException.ThrowIfNull(services);
            services.AddMiniProfiler(options =>
            {
                options.RouteBasePath = "/profiler";
                options.PopupRenderPosition = RenderPosition.Right;
                options.ShouldProfile = req => !req.Path.Value.EndsWith(".js") && !req.Path.Value.EndsWith(".css") && !req.Path.Value.EndsWith(".png"); // 添加此行以排除JS, CSS和图片文件
            });
        }
    }
}
